package com.zxy.ziems.server.device.pojo.bo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 坐标
 * @author 10348359
 * @create 2024-03-15 10:58
 */
@Data
public class Coordinate {

    /**
     * 原点x坐标
     */
    private BigDecimal x;

    /**
     * 原点y坐标
     */
    private BigDecimal y;

    /**
     * z坐标
     */
    private BigDecimal z;


    public static final Coordinate ZERO = new Coordinate(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO);

    @JsonIgnore
    public boolean isZero() {
        if (x.compareTo(BigDecimal.ZERO) != 0) {
            return false;
        }

        if (y.compareTo(BigDecimal.ZERO) != 0) {
            return false;
        }

        if (z.compareTo(BigDecimal.ZERO) != 0) {
            return false;
        }

        return true;
    }

    public Coordinate(BigDecimal x, BigDecimal y, BigDecimal z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    public Coordinate() {
    }
}
